Full source code website bán hàng thương mại điện tử gần giống shopee
468.894 lượt xem;
1 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
2 <tr><td width="45%" height="20" align="center" class="title">
3 Danh sách quản trị viên | <a href="?act=users_add"><font color="#ffffff">Thên quản trị</font></a>
4 </td></tr>
5 <tr><td>
6 <?
7 switch ($_GET['action'])
8 {
9 case 'del' :
10 $id = $_GET['id'];
11 $sql1="select * from user where id=$id limit 1";
12 $pro=mysql_fetch_assoc(mysql_query($sql1,$con));
13 $sql = "delete from user where id='".$id."'";
14 @$result = mysql_query($sql,$con);
15 if ($result)
16 {
17 if (file_exists("../".$pro['logo'])) unlink("../".$pro['logo']);
18 if (file_exists("../".$pro['banner'])) unlink("../".$pro['banner']);
19 if (file_exists("../".$pro['background'])) unlink("../".$pro['background']);
20 echo "<p align=center class='err'>Đã xóa thành công</p>";
21 }
22 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
23 break;
24 }
25 ?>
26
27 <?
28 if (isset($_POST['ButDel'])) {
29 $cnt=0;
30 foreach ($_POST['chk'] as $id)
31 {
32 $sql="select * from user where id=$id limit 1";
33 $pro=mysql_fetch_assoc(mysql_query($sql,$con));
34 @$result = mysql_query("delete from user where id='".$id."'",$con);
35 if ($result)
36 {
37 $cnt++;
38 if (file_exists("../".$pro['logo'])) unlink("../".$pro['logo']);
39 if (file_exists("../".$pro['banner'])) unlink("../".$pro['banner']);
40 if (file_exists("../".$pro['background'])) unlink("../".$pro['background']);
41 }
42 }
43 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
44 }
45 ?>
46 <?
47 $page = $_GET["page"];
48 $MAXPAGE=50;
49 $p=0;
50 if ($page!='') $p=$page;
51 ?>
52
53
54 <form method="POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
55 <input type="hidden" name="act" value="admin">
56 <input type=hidden name="page" value="<? echo $page; ?>">
57 <?
58 function taotrang($sql,$link,$nitem,$itemcurrent)
59 { global $con;
60 $ret="";
61 $result = mysql_query($sql, $con) or die('Error' . mysql_error());
62 $value = mysql_fetch_array($result);
63 $plus = (($value['cnt'] % $nitem)>0);
64 for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
65 {
66 if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
67 else $ret .= ($i+1)." ";
68 }
69 return $ret;
70 }
71 $pageindex=taotrang("select count(*) from user","./?act=admin"."&page=",$MAXPAGE,$page);
72 ?>
73
74 <table cellspacing="0" cellpadding="0">
75 <tr>
76 <td class="smallfont">Trang : <? echo $pageindex; ?></td>
77 </tr>
78 </table>
79
80
81 <tr><td>
82 <!-- begin danh sach -->
83 <form method="POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
84 <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
85 <tr class="title">
86 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
87 <td nowrap class="title"> </td>
88 <td nowrap class="title"> </td>
89 <td>ID</td>
90 <td>Tên đăng nhập</td>
91 <td>Mật khẩu</td>
92 </tr>
93 <? $sql=mysql_query("SELECT * FROM user order by id desc limit ".($p*$MAXPAGE).",".$MAXPAGE);
94 $i=0;
95 while($row=mysql_fetch_array($sql))
96 {
97 $i++;
98 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
99 ?>
100
101 <tr bgcolor="<? echo $color;?>">
102 <td width="20" align="center" class="smallfont"><input type="checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
103 <td width="20" bgcolor="<? echo $color; ?>" class="smallfont">
104 <a href="./?act=admin_add&cat=<? echo $_REQUEST['cat']; ?>&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
105 Sửa</a></td>
106 <td width="20" bgcolor="<? echo $color; ?>" class="smallfont">
107 <a href="./?act=admin&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
108 Xoá</a></td>
109 <td><? echo $row['id'];?></td>
110 <td><? echo $row['user'];?></td>
111 <td><? echo $row['pass'];?></td>
112
113 </tr>
114 <?}?>
115 </table>
116 <!-- end danh sach -->
117
118
119
120 </td></tr>
121 </table>
122 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button" style="padding: 0">
123 <input type="hidden" name="act" value="users">
124 </form>
125 <script language="JavaScript">
126 function chkallClick(o) {
127 var form = document.frmList;
128 for (var i = 0; i < form.elements.length; i++) {
129 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
130 form.elements[i].checked = document.frmList.chkall.checked;
131 }
132 }
133 }
134 </script>
2 <tr><td width="45%" height="20" align="center" class="title">
3 Danh sách quản trị viên | <a href="?act=users_add"><font color="#ffffff">Thên quản trị</font></a>
4 </td></tr>
5 <tr><td>
6 <?
7 switch ($_GET['action'])
8 {
9 case 'del' :
10 $id = $_GET['id'];
11 $sql1="select * from user where id=$id limit 1";
12 $pro=mysql_fetch_assoc(mysql_query($sql1,$con));
13 $sql = "delete from user where id='".$id."'";
14 @$result = mysql_query($sql,$con);
15 if ($result)
16 {
17 if (file_exists("../".$pro['logo'])) unlink("../".$pro['logo']);
18 if (file_exists("../".$pro['banner'])) unlink("../".$pro['banner']);
19 if (file_exists("../".$pro['background'])) unlink("../".$pro['background']);
20 echo "<p align=center class='err'>Đã xóa thành công</p>";
21 }
22 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
23 break;
24 }
25 ?>
26
27 <?
28 if (isset($_POST['ButDel'])) {
29 $cnt=0;
30 foreach ($_POST['chk'] as $id)
31 {
32 $sql="select * from user where id=$id limit 1";
33 $pro=mysql_fetch_assoc(mysql_query($sql,$con));
34 @$result = mysql_query("delete from user where id='".$id."'",$con);
35 if ($result)
36 {
37 $cnt++;
38 if (file_exists("../".$pro['logo'])) unlink("../".$pro['logo']);
39 if (file_exists("../".$pro['banner'])) unlink("../".$pro['banner']);
40 if (file_exists("../".$pro['background'])) unlink("../".$pro['background']);
41 }
42 }
43 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
44 }
45 ?>
46 <?
47 $page = $_GET["page"];
48 $MAXPAGE=50;
49 $p=0;
50 if ($page!='') $p=$page;
51 ?>
52
53
54 <form method="POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
55 <input type="hidden" name="act" value="admin">
56 <input type=hidden name="page" value="<? echo $page; ?>">
57 <?
58 function taotrang($sql,$link,$nitem,$itemcurrent)
59 { global $con;
60 $ret="";
61 $result = mysql_query($sql, $con) or die('Error' . mysql_error());
62 $value = mysql_fetch_array($result);
63 $plus = (($value['cnt'] % $nitem)>0);
64 for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
65 {
66 if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
67 else $ret .= ($i+1)." ";
68 }
69 return $ret;
70 }
71 $pageindex=taotrang("select count(*) from user","./?act=admin"."&page=",$MAXPAGE,$page);
72 ?>
73
74 <table cellspacing="0" cellpadding="0">
75 <tr>
76 <td class="smallfont">Trang : <? echo $pageindex; ?></td>
77 </tr>
78 </table>
79
80
81 <tr><td>
82 <!-- begin danh sach -->
83 <form method="POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
84 <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
85 <tr class="title">
86 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
87 <td nowrap class="title"> </td>
88 <td nowrap class="title"> </td>
89 <td>ID</td>
90 <td>Tên đăng nhập</td>
91 <td>Mật khẩu</td>
92 </tr>
93 <? $sql=mysql_query("SELECT * FROM user order by id desc limit ".($p*$MAXPAGE).",".$MAXPAGE);
94 $i=0;
95 while($row=mysql_fetch_array($sql))
96 {
97 $i++;
98 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
99 ?>
100
101 <tr bgcolor="<? echo $color;?>">
102 <td width="20" align="center" class="smallfont"><input type="checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
103 <td width="20" bgcolor="<? echo $color; ?>" class="smallfont">
104 <a href="./?act=admin_add&cat=<? echo $_REQUEST['cat']; ?>&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
105 Sửa</a></td>
106 <td width="20" bgcolor="<? echo $color; ?>" class="smallfont">
107 <a href="./?act=admin&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
108 Xoá</a></td>
109 <td><? echo $row['id'];?></td>
110 <td><? echo $row['user'];?></td>
111 <td><? echo $row['pass'];?></td>
112
113 </tr>
114 <?}?>
115 </table>
116 <!-- end danh sach -->
117
118
119
120 </td></tr>
121 </table>
122 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button" style="padding: 0">
123 <input type="hidden" name="act" value="users">
124 </form>
125 <script language="JavaScript">
126 function chkallClick(o) {
127 var form = document.frmList;
128 for (var i = 0; i < form.elements.length; i++) {
129 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
130 form.elements[i].checked = document.frmList.chkall.checked;
131 }
132 }
133 }
134 </script>